package com.bug.event.test;

import java.util.concurrent.atomic.AtomicInteger;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class DemoAopAspect {

  private AtomicInteger counter = new AtomicInteger();

  @Around(value = "@annotation(aopAnnotation)")
  public Object around(ProceedingJoinPoint joinPoint, DemoAopAnnotation aopAnnotation) throws Throwable {
    Object ret = null;
    System.err.println("Enter Aop counter:" + counter.incrementAndGet());
    ret = joinPoint.proceed();
    return ret;
  }

}